{{:ModuleInclude('public/header')}}

<!-- right content start  -->
<div class="content-right">
	<div class="content">
        <!-- nav start -->
        {{if !isset($is_theme_data_admin) or $is_theme_data_admin eq 0}}
            {{:ModuleInclude('public/admin_nav', [
                'title'     => MyLang('article.base_nav_title').(empty($data['id']) ? MyLang('created_title') : MyLang('edit_title')),
                'back_url'  => MyUrl('admin/article/index', $params)
            ])}}
        {{/if}}
        <!-- nav end -->

        <!-- form start -->
        <form class="am-form form-validation am-form-full-screen am-form-popup-sticky" action="{{:MyUrl('admin/article/save')}}" method="POST" request-type="{{if !isset($is_theme_data_admin) or $is_theme_data_admin eq 0}}ajax-url{{else /}}ajax-reload{{/if}}" request-value="{{if !isset($is_theme_data_admin) or $is_theme_data_admin eq 0}}{{:MyUrl('admin/article/index', $params)}}{{else /}}parent{{/if}}">
            <div class="am-form-group">
                <label>{{:MyLang('common_service.article.form_item_title')}}<span class="am-form-group-label-tips-must">*</span></label>
                <div class="am-input-group am-input-group-sm am-flex am-gap-1-half am-flex-items-center">
                    <input type="text" name="title" placeholder="{{:MyLang('common_service.article.form_item_title_message')}}" minlength="2" maxlength="60" data-validation-message="{{:MyLang('common_service.article.form_item_title_message')}}" class="am-form-field am-radius" {{if !empty($data['title'])}} value="{{$data.title}}" {{/if}} {{if !empty($data['title_color'])}} style="color:{{$data.title_color}};" {{/if}} required />
                    <div class="colorpicker-container colorpicker-simple">
                        <input type="hidden" name="title_color" value="{{if !empty($data['title_color'])}}{{$data.title_color}}{{/if}}" />
                        <div class="colorpicker-submit" data-color="{{if !empty($data['title_color'])}}{{$data.title_color}}{{/if}}" data-input-tag="input[name='title']" data-color-tag="input[name='title_color']"></div>
                        <img class="imitate-colorpicker-submit" src="{{:StaticAttachmentUrl('colorpicker.png')}}" width="24" height="24" />
                    </div>
                </div>
            </div>
            <div class="am-form-group">
                <label>{{:MyLang('common_service.article.form_item_article_category')}}<span class="am-form-group-label-tips-must">*</span></label>
                <select name="article_category_id" class="am-radius chosen-select" data-placeholder="{{:MyLang('optional_tips')}}" data-validation-message="{{:MyLang('common_service.article.form_item_article_category_message')}}" required>
                    <option value="">{{:MyLang('optional_tips')}}</option>
                    {{foreach $article_category_list as $v}}
                        <option value="{{$v.id}}" {{if isset($data['article_category_id']) and $data['article_category_id'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
                    {{/foreach}}
                </select>
            </div>

            <div class="am-form-group">
                <label>{{:MyLang('common_service.article.form_item_jump_url_title')}}<a href="javascript:;" class="am-icon-question-circle am-margin-left-xs" data-am-popover="{content: '{{:MyLang('common_service.article.form_item_jump_url_tips')}}', trigger: 'hover focus', theme: 'sm'}"></a></label>
                <input type="url" name="jump_url" placeholder="{{:MyLang('common_service.article.form_item_jump_url_title')}}" data-validation-message="{{:MyLang('common_service.article.form_item_jump_url_message')}}" class="am-radius" {{if !empty($data['jump_url'])}} value="{{$data.jump_url}}"{{/if}} />
            </div>

            <div class="am-form-group am-form-file">
                <label class="am-block">{{:MyLang('common_service.article.form_item_cover')}}<a href="javascript:;" class="am-icon-question-circle am-margin-left-xs" data-am-popover="{content: '{{:MyLang('common_service.article.form_item_cover_tips')}}', trigger: 'hover focus', theme: 'sm'}"></a></label>
                <div class="am-form-file-upload-container">
                    <ul class="plug-file-upload-view article-cover-view" data-form-name="cover" data-max-number="1" data-dialog-type="images" data-is-eye="1">
                        <li class="plug-file-upload-submit" data-view-tag="ul.article-cover-view">
                            {{if empty($data['cover'])}}
                                <i class="iconfont icon-upload-add"></i>
                            {{else /}}
                                <input type="text" name="cover" value="{{$data.cover}}" />
                                <img src="{{$data.cover}}" />
                                <i class="iconfont icon-close"></i>
                                <i class="iconfont icon-eye"></i>
                            {{/if}}
                        </li>
                    </ul>
                </div>
            </div>

            {{:ModuleInclude('lib/is_enable')}}

            <div class="am-form-group">
                <label class="am-block">{{:MyLang('common_service.article.form_item_is_home_recommended_title')}}</label>
                <input name="is_home_recommended" value="1" type="checkbox" data-off-text="{{:MyLang('no_title')}}" data-on-text="{{:MyLang('yes_title')}}" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if isset($data['is_home_recommended']) and $data['is_home_recommended'] eq 1}}checked="true"{{/if}} />
            </div>

            <div class="am-form-group">
                <label>{{:MyLang('common_service.article.form_item_describe')}}</label>
                <textarea class="am-radius" name="describe" rows="4" maxlength="230" placeholder="{{:MyLang('common_service.article.form_item_describe_message')}}" data-validation-message="{{:MyLang('common_service.article.form_item_describe_message')}}">{{if !empty($data['describe'])}}{{$data.describe}}{{/if}}</textarea>
            </div>

            <div class="am-form-group">
                <label>{{:MyLang('common_service.article.form_item_content_title')}}<span class="am-form-group-label-tips-must">*</span></label>
                <textarea class="am-radius am-validate" name="content" rows="5" minlength="10" {{if !IsMobile()}}id="editor-tag" data-url="{{:MyUrl('admin/ueditor/index', ['path_type'=>'article'])}}" placeholder="{{:MyLang('common_service.article.form_item_content_message')}}" {{else /}} placeholder="{{:MyLang('common_service.article.form_item_content_placeholder')}}" {{/if}} data-validation-message="{{:MyLang('common_service.article.form_item_content_message')}}" required>{{if !empty($data['content'])}}{{$data.content}}{{/if}}</textarea>
            </div>

            <!-- 插件扩展数据 start -->
            {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_admin_article_save</span>
                </div>
            {{/if}}
            {{if !empty($plugins_view_admin_article_save_data) and is_array($plugins_view_admin_article_save_data)}}
                <div class="card-grey am-margin-bottom-lg">
                    <label class="am-text-sm am-text-warning">{{:MyLang('plugins_view_region_config_tips')}}</label>
                    <div>
                        {{foreach $plugins_view_admin_article_save_data as $hook}}
                            {{if is_string($hook) or is_int($hook)}}
                                {{$hook|raw}}
                            {{/if}}
                        {{/foreach}}
                    </div>
                </div>
            {{/if}}
            <!-- 插件扩展数据 end -->

            {{:ModuleInclude('lib/seo')}}

            <div class="am-form-popup-submit">
                <input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
                <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner: 'circle-o-notch', loadingText:'{{:MyLang('save_title')}}'}">
                    <i class="am-icon-save"></i>
                    <span>{{:MyLang('save_title')}}</span>
                </button>
            </div>
        </form>
        <!-- form end -->
	</div>
</div>
<!-- right content end  -->

<!-- footer start -->
{{:ModuleInclude('public/footer')}}